const DxfParser = require("dxf-parser");
// 读取DXF文件
const fs = require("fs");
const dxfContent = fs.readFileSync("test.dxf", "utf-8");

let parser = new DxfParser();

// 解析DXF文件
const dxf = parser.parseSync(dxfContent);
const str = JSON.stringify(dxf);
console.log(dxf.entities);
// console.log(str);

fs.writeFile("test.json", str, "utf-8", (err) => {
  console.log(err);
});
